Imports Leadtools.Dicom.Common.Anonymization
Public Sub MacroProcessorSample()
Dim processor As New MacroProcessor(Of Object)()
'
' add two macros to the macro processor
'
processor.Macros.Add("current_date", New MacroSubsitutionDelegate(Of Object)(AddressOf CurrentDateMacro))
processor.Macros.Add("current_time", New MacroSubsitutionDelegate(Of Object)(AddressOf CurrentTimeMacro))
'
' Process a macro string
'
Console.WriteLine(processor.Process(processor, "${current_date} ==> ${current_time}"))
End Sub
Private Function CurrentDateMacro(ByVal userData As Object, ByVal name As String, ByVal ParamArray parameters As Object()) As String
Return DateTime.Now.ToShortDateString()
End Function
Private Function CurrentTimeMacro(ByVal userData As Object, ByVal name As String, ByVal ParamArray parameters As Object()) As String
Return DateTime.Now.ToShortTimeString()
End Function